package com.quanyue.haircut.shop.service.impl;

import com.quanyue.haircut.domain.entity.SlideImage;
import com.quanyue.haircut.shop.mapper.SlideMapper;
import com.quanyue.haircut.shop.service.SlideService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
public class SlideServiceImpl implements SlideService {
    @Autowired
    private SlideMapper slideMapper;

    @Override
    public void create(SlideImage image) {
        image.setCreateTime(LocalDateTime.now());
        image.setUpdateTime(LocalDateTime.now());
        slideMapper.insert(image);
    }

    @Override
    public void update(SlideImage image) {
        image.setUpdateTime(LocalDateTime.now());
        slideMapper.updateSelective(image);
    }

    @Override
    public void delete(Integer id) {
        slideMapper.deleteOne(id);
    }

    @Override
    public List <SlideImage> findList(Integer merchantNo) {
        return slideMapper.findByMerchantNo(merchantNo);
    }
}
